<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script type="text/javascript" src="../vue.js"></script>
  <style>
    .box {
      width: 200px;
      height: 200px;
      background: green;
    }

    /* 显示
enter
enter-active
enter-to */
    .box-enter {
      opacity: 0;
      width: 50px;
      height: 50px;
    }

    .box-enter-active {
      transition: all 2s;
      animation:move 2s;
    }

    .box-enter-to {
      width: 100px;
      height: 100px;
      background: green;
    }

    @keyframes move {
      50% {
        transform: rotate(-90deg);
      }
      100% {
        transform: rotate(-270deg);
      }
    }

    /* 隐藏
leave
leave-active
leave-to */

    .box-leave {
      width: 200px;
      height: 200px;
      background: green;
    }
    .box-leave-active{
      transition: all 4s;
      animation:move 4s;
    }

    .box-leave-to{
      opacity: 0;
      width: 10px;
      height: 10px;
    }

    .aa{

    }


  </style>
</head>

<body>
  <div id="app">

    <transition name="box" enter-class="aa">
      <div class="box" v-if="show"></div>
    </transition>

    <button @click="show=!show">显示/隐藏</button>

  </div>

  <script>

    var vm = new Vue({
      data: {
        show: true
      },
      el: "#app"
    })

  </script>
</body>

</html>